package com.yj.cmp.sdk.fusioncompute.common.utils;

import com.yj.cmp.sdk.fusioncompute.compute.cluster.FcClusterApi;
import com.yj.cmp.sdk.fusioncompute.compute.cluster.FcClusterService;
import com.yj.cmp.sdk.fusioncompute.compute.host.FcHostApi;
import com.yj.cmp.sdk.fusioncompute.compute.host.FcHostService;
import com.yj.cmp.sdk.fusioncompute.compute.image.FcImageApi;
import com.yj.cmp.sdk.fusioncompute.compute.image.FcImageService;
import com.yj.cmp.sdk.fusioncompute.compute.vm.FcVmApi;
import com.yj.cmp.sdk.fusioncompute.compute.vm.FcVmService;
import com.yj.cmp.sdk.fusioncompute.identity.FcIdentityApi;
import com.yj.cmp.sdk.fusioncompute.identity.FcIdentityService;
import com.yj.cmp.sdk.fusioncompute.network.dvswitch.FcSwitchApi;
import com.yj.cmp.sdk.fusioncompute.network.dvswitch.FcSwitchService;
import com.yj.cmp.sdk.fusioncompute.network.portgroup.FcPortGroupApi;
import com.yj.cmp.sdk.fusioncompute.network.portgroup.FcPortGroupService;
import com.yj.cmp.sdk.fusioncompute.network.securitygroup.FcSecurityGroupApi;
import com.yj.cmp.sdk.fusioncompute.network.securitygroup.FcSecurityGroupService;
import com.yj.cmp.sdk.fusioncompute.storage.storage.FcStorageApi;
import com.yj.cmp.sdk.fusioncompute.storage.storage.FcStorageService;
import com.yj.cmp.sdk.fusioncompute.storage.volume.FcVolumeApi;
import com.yj.cmp.sdk.fusioncompute.storage.volume.FcVolumeService;
import lombok.Data;
import retrofit2.Retrofit;

/**
 * @author Harvey_Yang
 * @date 2021/8/30 9:52
 */
@Data
public class ApiInitUtil {

    FcHostApi fcHostApi;
    FcImageApi fcImageApi;
    FcVolumeApi fcVolumeApi;
    FcSwitchApi fcSwitchApi;
    FcStorageApi fcStorageApi;
    FcClusterApi fcClusterApi;
    FcIdentityApi fcIdentityApi;
    FcPortGroupApi fcPortGroupApi;
    FcSecurityGroupApi fcSecurityGroupApi;
    FcVmApi fcVmApi;

    public ApiInitUtil(String address) {
        Retrofit client = RequestUtils.getClient(address);
        fcHostApi = new FcHostApi(client.create(FcHostService.class));
        fcImageApi = new FcImageApi(client.create(FcImageService.class));
        fcSwitchApi = new FcSwitchApi(client.create(FcSwitchService.class));
        fcVolumeApi = new FcVolumeApi(client.create(FcVolumeService.class));
        fcClusterApi = new FcClusterApi(client.create(FcClusterService.class));
        fcStorageApi = new FcStorageApi(client.create(FcStorageService.class));
        fcIdentityApi = new FcIdentityApi(client.create(FcIdentityService.class));
        fcPortGroupApi = new FcPortGroupApi(client.create(FcPortGroupService.class));
        fcSecurityGroupApi = new FcSecurityGroupApi(client.create(FcSecurityGroupService.class));
        fcVmApi = new FcVmApi(client.create(FcVmService.class));
    }

}
